package com.qf.controller;

import com.qf.pojo.Man;
import com.qf.pojo.Result;
import com.qf.service.WelManService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/wel")
public class WelManController {

    @Autowired
    private WelManService welManService;

    @GetMapping
    public Result getWelMans(){
        List<Man> welMans = welManService.getWelMans();
        return Result.success(welMans);
    }

    @PostMapping("/incr")
    public Result incrScore(String name,Double score){
        welManService.incr(name,score+1);
        return Result.success("投票成功");
    }
}
